package com.jt.controller;

import com.jt.pojo.Content;
import com.jt.service.ContentService;
import com.jt.vo.EasyUITable;
import com.jt.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author dc
 * @Classname ContentController
 * @Date 2020/3/24 11:43
 */
@RestController
@RequestMapping("/content")
public class ContentController {

    @Autowired
    ContentService contentService;

    @RequestMapping("/query/list")
    public EasyUITable getContentByCategoryId(Integer page,Integer rows,Long categoryId){
        return contentService.getContentByCategoryId(page,rows,categoryId);
    }

    @RequestMapping("/save")
    public SysResult saveContent(Content content){
        contentService.saveContent(content);
        return SysResult.success();
    }

    @RequestMapping("delete")
    public SysResult deleteContentByIds(Long[] ids){
        contentService.deleteConByIds(ids);
        return SysResult.success();
    }

    @RequestMapping("/edit")
    public SysResult updateContent(Content content){
        contentService.updateContent(content);
        return SysResult.success();
    }
}
